package com.bqy.myokgo.base;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.widget.FrameLayout;

import com.bqy.myokgo.R;

import razerdp.basepopup.BasePopupWindow;

/**
 * 熊猫先生
 * 2018/10/24:10:43
 * 中间的popup
 */

public abstract class MyBaseCenterPopup extends BasePopupWindow {

    private FrameLayout default_popup_context;

    public MyBaseCenterPopup(Context context) {
        super(context);
        setBackground(R.color.BJ);
        setBlurBackgroundEnable(true);
        iniView();
    }

    @Override
    protected Animation onCreateShowAnimation() {
        return getTranslateVerticalAnimation(1f, 0f, 300);
    }

    @Override
    protected Animation onCreateDismissAnimation() {
        return getTranslateVerticalAnimation(0f, 1f, 300);
    }

    @Override
    public View onCreateContentView() {
        return createPopupById(R.layout.default_base_center_popup);
    }


    private void iniView() {
        default_popup_context = findViewById(R.id.default_popup_context);
        if (setContentView() != null) {
            default_popup_context.addView(setContentView());
        }
    }


    public abstract View setContentView();

}
